<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>地区信息</title>
    <!--<link href="../../script/css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../script/css/bootstrap-table.css" rel="stylesheet" />
    <script src="../../script/js/jquery-1.12.3.js"></script>
    <script src="../../script/js/bootstrap.min.js"></script>
    <script src="../../script/js/bootstrap-table.js"></script>
    <script src="../../script/js/bootstrap-table-zh-CN.js"></script>
    <script src="../../script/js/cus-grid.js"></script>-->
</head>
<body>
    <div style="width:100%">
        <table name="base_area"></table>
    </div>
    <script name="loadPage">
        var base_area_init;

        var base_area = {
        data: {
                data:[]
        },
        detailLink:[],
            rowbtns:[],
        toolbtns:[],
        cols:[],
        new: function () {
            base_area_init.editLoad('base_area_edit.html');
        },
        edit: function () {
            base_area_init.editLoad('base_area_edit.html');
        },
        del: function () {
            $.post('/api/base_area/del', { id: base_area_init.getId_edit }, function () {
                window.location.reload();
        });
        },
        mdel: function () {
            $.post('/api/base_area/mdel', { objs: base_area_init.getSelects() }, function () {
                window.location.reload();
        });
        },
        check: function () {

        },
        mcheck: function () {

        }
        };

        $(function () {
            base_area.cols = [
{field: 'code',title: '编号'}
,{field: 'name',title: '地名'}
,{field: 'parentid',title: '上级地名',formatter: function (val, row, idx) {
                                            var str = '';
                                            for (var i = 0; i < base_area.data['parentid'].length; i++) {
                                                var p = base_area.data['parentid'][i];
                                                if (p.id == val) {
                                                    str = str == '' ? p.text : str + ',' + p.text;
                                                }
                                            }
                                            return str;
                                        }}
,{field: 'hard',title: '硬货运价（吨）'}
,{field: 'bulky',title: '泡货运价（方）'}
                ];

            base_area.rowbtns.push({
                text: '编辑',
                fn: 'base_area.edit'
            });
            base_area.rowbtns.push({
                text: '删除',
                fn: 'base_area.del'
            });
            base_area.rowbtns.push({
                jstr: '<button class="btn btn-danger" onclick="base_area.check();">审核</button>'
            });

            base_area.toolbtns.push({
                text: '新增',
                fn: 'base_area.new'
            });
            base_area.toolbtns.push({
                text: '删除',
                fn: 'base_area.mdel'
            });
            base_area.toolbtns.push({
                jstr: '<button class="btn btn-danger" onclick="base_area.mcheck();">审核</button>'
            });

            //base_area.detailLink.push({
            //    tablename: 'table2',
            //    parentid: 'name',
            //    caption: 'tname',
            //    isActive: true
            //});

            base_area_init = base_area_init == undefined ? cusGrid() : function () {
                return base_area_init.reCreate();
            }();
            $.get('/api/base_area/get',
null ,
                    function (data) {
            base_area.data = data;
        base_area_init.init({
            data: base_area.data,
                detailLink: base_area.detailLink,
                    rowbtns: base_area.rowbtns,
                        toolbtns: base_area.toolbtns,
                            cols: base_area.cols,
                                isSelect:true,
                                tableName: 'base_area'
                            });
        base_area_init.initTable();
        });
        })
    </script>



</body>
</html>
